package cn.eonshine.cuba.inf.modular.basic.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.eonshine.base.core.base.controller.BaseController;
import cn.eonshine.cuba.inf.common.http.Message;
import cn.eonshine.cuba.inf.modular.basic.service.IOilDepotService;

/**
 * 控制器
 *
 * @author fengshuonan
 * @Date 2018-07-28 16:19:52
 */
@Controller
@RequestMapping("/oilDepot")
public class OilDepotController extends BaseController {

  
    @Autowired
    private IOilDepotService oilDepotService;

    @Value("${data.isUpdate:0}")
    private int isUpdate;
   
    @RequestMapping(value = "/list")
    @ResponseBody
    public Message list(@RequestBody Message message) {
        return oilDepotService.queryDataList(message);
    }

    @RequestMapping(value = "/delete")
    @ResponseBody
    public Object delete(@RequestParam Integer oilDepotId) {
        oilDepotService.removeById(oilDepotId);
        return SUCCESS_TIP;
    }

    @RequestMapping(value = "/update")
    @ResponseBody
    public Message update(@RequestBody Message message) {
        return oilDepotService.changeLsmsUpdate(message, isUpdate);
    }
}
